# Valid web server entry point, enable includes
define( "MEDIAWIKI", true );
+require_once( "includes/Defines.php" );
require_once( "./LocalSettings.php" );
require_once( "includes/Setup.php" );
+if( !isset( $_SERVER['PATH_INFO'] ) ) {
+ wfForbidden();
+}
+
# Get filenames/directories
$filename = realpath( $wgUploadDirectory . $_SERVER['PATH_INFO'] );
$realUploadDirectory = realpath( $wgUploadDirectory );
wfForbidden();
}
+if( !file_exists( $filename ) ) {
+ wfForbidden();
+}
+if( is_dir( $filename ) ) {
+ wfForbidden();
+}
+
# Write file
$type = wfGetType( $filename );
if ( $type ) {
header("Content-type: $type");
+} else {
+ header("Content-type: application/x-wiki");
}
readfile( $filename );
model/vrml wrl vrml
text/calendar ics ifb
text/css css
-text/html html htm
-text/plain asc txt
text/richtext rtx
text/rtf rtf
text/sgml sgml sgm
$endl = "
";
$types = explode( $endl, $types );
- if ( !preg_match( "/\.(.*?)$/", $filename, $matches ) ) {
+ if ( !preg_match( "/\.([^.]*?)$/", $filename, $matches ) ) {
return false;
}
if( function_exists( 'mysql_thread_id' ) ) {
# This will kill the query if it's still running after $timeout seconds.
$tid = mysql_thread_id( $this->mConn );
- exec( "php $IP/killthread.php $timeout $tid &>/dev/null &" );
+ exec( "php $IP/includes/killthread.php $timeout $tid &>/dev/null &" );
}
}
/**
*
*/
+if( php_sapi_name() != 'cli' ) {
+ die('');
+}
+
+define( 'MEDIAWIKI', 1 );
$wgCommandLineMode = true;
unset( $IP );
ini_set( 'allow_url_fopen', 0 ); # For security...
-require_once( './LocalSettings.php' );
+require_once( '../LocalSettings.php' );
-# Windows requires ';' as separator, ':' for Unix
-$sep = strchr( $include_path = ini_get( 'include_path' ), ';' ) ? ';' : ':';
-ini_set( 'include_path', "$IP$sep$include_path" );
+if( !$wgAllowSysopQueries ) {
+ die( "Queries disabled.\n" );
+}
require_once( 'Setup.php' );
* @package MediaWiki
*/
+if( php_sapi_name() != 'cli' ) {
+ die('');
+}
+
/**
*
*/
wfCreativeCommonsRdf( $wgArticle );
}
break;
- case "credits":
- require_once( "includes/Credits.php" );
+ case "credits":
+ require_once( "includes/Credits.php" );
showCreditsPage( $wgArticle );
- break;
+ break;
case "edit":
case "submit":
if( !$wgCommandLineMode && !$wgRequest->checkSessionCookie() ) {